/*
Copyright (c) [2019年5月1日] [吴超]
[MBT_Studio] is licensed under Mulan PSL v2.
You can use this software according to the terms and conditions of the Mulan PSL v2.
You may obtain a copy of Mulan PSL v2 at:
		 http://license.coscl.org.cn/MulanPSL2
THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
See the Mulan PSL v2 for more details.
*/
#include "str_字符串读写.h"

void f_str_分割(std::vector<std::string>& strArray, const std::string& str, int8 分割字符) {
	auto p = str.data();
	uint32 num = str.size();

	std::string tempStr;
	for (uint32 i = 0; i < num; ++i) {
		if (p[i] == 分割字符) {
			if (tempStr.size()) {
				strArray.emplace_back(tempStr);
			}
			tempStr.clear();
		}
		else {
			tempStr += p[i];
		}
	}

	if (tempStr.size()) {
		strArray.push_back(tempStr);
	}
}
